home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / gnu / gnpltsrc.lha / bitmap.c < prev    next >
C/C++ Source or Header  |  1996-01-22  |  52KB  |  1,078 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: bitmap.c,v 1.9 1995/12/02 21:16:33 drd Exp $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - bitmap.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  27.  *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  28.  *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  29.  * 
  30.  * There is a mailing list for gnuplot users. Note, however, that the
  31.  * newsgroup 
  32.  *    comp.graphics.gnuplot 
  33.  * is identical to the mailing list (they
  34.  * both carry the same set of messages). We prefer that you read the
  35.  * messages through that newsgroup, to subscribing to the mailing list.
  36.  * (If you can read that newsgroup, and are already on the mailing list,
  37.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  38.  * removed from the mailing list.)
  39.  *
  40.  * The address for mailing to list members is
  41.  *       info-gnuplot@dartmouth.edu
  42.  * and for mailing administrative requests is 
  43.  *       info-gnuplot-request@dartmouth.edu
  44.  * The mailing list for bug reports is 
  45.  *       bug-gnuplot@dartmouth.edu
  46.  * The list of those interested in beta-test versions is
  47.  *       info-gnuplot-beta@dartmouth.edu
  48.  */
  49.  
  50. /*
  51. ** General raster plotting routines.
  52. ** Raster routines written and copyrighted 1987 by
  53. ** Jyrki Yli-Nokari (jty@intrin.UUCP)
  54. ** Intrinsic, Ltd.
  55. **
  56. ** You may use this code for anything you like as long as
  57. ** you are not selling it and the credit is given and
  58. ** this message retained.
  59. **
  60. */
  61.  
  62. /* Bitmap plotting routines derived from above raster plotting routines
  63.  * Russell Lang, 1990
  64.  */
  65.  
  66. #include "plot.h"
  67. #include "bitmap.h"
  68.  
  69. bitmap *b_p = (bitmap *)NULL;    /* global pointer to bitmap */
  70. unsigned int b_currx, b_curry;    /* the current coordinates */
  71. unsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  72. unsigned int b_planes;            /* number of color planes */
  73. unsigned int b_psize;            /* size of each plane */
  74. unsigned int b_rastermode;        /* raster mode rotates -90deg */
  75. unsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  76. unsigned int b_value = 1;        /* colour of lines */
  77. unsigned int b_hchar;            /* width of characters */
  78. unsigned int b_hbits;            /* actual bits in char horizontally */
  79. unsigned int b_vchar;            /* height of characters */
  80. unsigned int b_vbits;            /* actual bits in char vertically */
  81. unsigned int b_angle;            /* rotation of text */
  82. char_box b_font[FNT_CHARS];    /* the current font */
  83. unsigned int b_pattern[] = {0xffff, 0x1111,
  84.     0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  85. int b_maskcount = 0;
  86. unsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  87.  
  88. #define IN(i,size)  ((unsigned)i < (unsigned)size)
  89.  
  90. /* 5x9 font, bottom row first, left pixel in lsb */
  91. char_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  92.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  93.   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  94.   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  95.   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  96.   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  97.   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  98.   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  99.   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  100.   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  101.   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  102.   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  103.   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  104.   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  105.   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  106.   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  107.   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  108.   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  109.   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  110.   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  111.   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  112.   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  113.   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  114.   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  115.   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  116.   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  117.   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  118.   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  119.   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  120.   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  121.   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  122.   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  123.   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  124.   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  125.   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  126.   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  127.   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  128.   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  129.   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  130.   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  131.   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  132.   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  133.   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  134.   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  135.   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  136.   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  137.   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  138.   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  139.   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  140.   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  141.   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  142.   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  143.   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  144.   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  145.   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  146.   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  147.   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  148.   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  149.   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  150.   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  151.   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  152.   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  153.   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  154.   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  155.   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  156.   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  157.   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  158.   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  159.   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  160.   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  161.   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  162.   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  163.   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  164.   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  165.   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  166.   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  167.   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  168.   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  169.   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  170.   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  171.   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  172.   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  173.   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  174.   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  175.   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  176.   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  177.   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  178.   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  179.   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  180.   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  181.   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  182.   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  183.   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  184.   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  185.   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  186.   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  187.   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  188. };
  189.  
  190. /* 9x17 font, bottom row first, left pixel in lsb */
  191. char_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  192.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  193.           000000,000000,000000,000000,000000,000000,000000,000000},
  194.   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  195.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  196.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  197.           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  198.   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  199.           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  200.   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  201.           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  202.   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  203.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  204.   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  205.           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  206.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  207.           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  208.   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  209.           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  210.   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  211.           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  212.   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  213.           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  214.   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  215.           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  216.   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  217.           000000,000000,000000,000000,000000,000000,000000,000000},
  218.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  219.           000000,0x01ff,000000,000000,000000,000000,000000,000000},
  220.   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  221.           000000,000000,000000,000000,000000,000000,000000,000000},
  222.   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  223.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  224.   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  225.           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  226.   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  227.           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  228.   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  229.           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  230.   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  231.           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  232.   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  233.           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  234.   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  235.           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  236.   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  237.           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  238.   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  239.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  240.   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  241.           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  242.   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  243.           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  244.   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  245.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  246.   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  247.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  248.   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  249.           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  250.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  251.           000000,000000,000000,0x01ff,000000,000000,000000,000000},
  252.   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  253.           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  254.   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  255.           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  256.   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  257.           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  258.   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  259.           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  260.   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  261.           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  262.   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  263.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  264.   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  265.           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  266.   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  267.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  268.   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  269.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  270.   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  271.           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  272.   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  273.           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  274.   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  275.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  276.   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  277.           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  278.   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  279.           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  280.   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  281.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  282.   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  283.           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  284.   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  285.           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  286.   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  287.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  288.   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  289.           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  290.   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  291.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  292.   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  293.           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  294.   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  295.           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  296.   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  297.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  298.   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  299.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  300.   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  301.           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  302.   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  303.           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  304.   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  305.           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  306.   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  307.           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  308.   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  309.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  310.   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  311.           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  312.   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  313.           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  314.   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  315.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  316.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  317.           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  318.   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  319.           000000,000000,000000,000000,000000,000000,000000,000000},
  320.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  321.           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  322.   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  323.           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  324.   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  325.           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  326.   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  327.           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  328.   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  329.           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  330.   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  331.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  332.   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  333.           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  334.   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  335.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  336.   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  337.           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  338.   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  339.           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  340.   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  341.           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  342.   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  343.           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  344.   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  345.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  346.   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  347.           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  348.   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  349.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  350.   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  351.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  352.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  353.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  354.   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  355.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  356.   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  357.           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  358.   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  359.           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  360.   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  361.           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  362.   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  363.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  364.   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  365.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  366.   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  367.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  368.   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  369.           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  370.   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  371.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  372.   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  373.           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  374.   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  375.           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  376.   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  377.           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  378.   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  379.           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  380.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  381.           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  382.   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  383.           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  384. };
  385.  
  386. /* 13x25 font, bottom row first, left pixel in lsb */
  387. char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  388.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  389.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  390.           000000,000000,000000,000000,000000,000000,000000},
  391.   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  392.           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  393.           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  394.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  395.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  396.           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  397.   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  398.           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  399.           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  400.   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  401.           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  402.           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  403.   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  404.           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  405.           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  406.   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  407.           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  408.           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  409.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  410.           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  411.           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  412.   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  413.           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  414.           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  415.   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  416.           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  417.           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  418.   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  419.           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  420.           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  421.   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  422.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  423.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  424.   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  425.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  426.           000000,000000,000000,000000,000000,000000,000000},
  427.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  428.           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  429.           000000,000000,000000,000000,000000,000000,000000},
  430.   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  431.           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  432.           000000,000000,000000,000000,000000,000000,000000},
  433.   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  434.           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  435.           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  436.   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  437.           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  438.           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  439.   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  440.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  441.           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  442.   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  443.           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  444.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  445.   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  446.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  447.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  448.   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  449.           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  450.           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  451.   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  452.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  453.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  454.   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  455.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  456.           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  457.   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  458.           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  459.           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  460.   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  461.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  462.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  463.   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  464.           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  465.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  466.   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  467.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  468.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  469.   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  470.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  471.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  472.   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  473.           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  474.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  475.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  476.           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  477.           0x1fff,000000,000000,000000,000000,000000,000000},
  478.   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  479.           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  480.           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  481.   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  482.           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  483.           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  484.   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  485.           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  486.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  487.   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  488.           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  489.           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  490.   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  491.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  492.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  493.   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  494.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  495.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  496.   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  497.           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  498.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  499.   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  500.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  501.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  502.   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  503.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  504.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  505.   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  506.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  507.           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  508.   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  509.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  510.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  511.   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  512.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  513.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  514.   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  515.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  516.           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  517.   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  518.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  519.           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  520.   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  521.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  522.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  523.   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  524.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  525.           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  526.   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  527.           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  528.           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  529.   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  530.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  531.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  532.   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  533.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  534.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  535.   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  536.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  537.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  538.   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  539.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  540.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  541.   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  542.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  543.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  544.   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  545.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  546.           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  547.   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  548.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  549.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  550.   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  551.           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  552.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  553.   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  554.           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  555.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  556.   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  557.           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  558.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  559.   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  560.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  561.           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  562.   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  563.           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  564.           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  565.   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  566.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  567.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  568.   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  569.           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  570.           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  571.   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  572.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  573.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  574.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  575.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  576.           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  577.   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  578.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  579.           000000,000000,000000,000000,000000,000000,000000},
  580.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  581.           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  582.           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  583.   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  584.           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  585.           0x03f8,000000,000000,000000,000000,000000,000000},
  586.   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  587.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  588.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  589.   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  590.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  591.           0x03f8,000000,000000,000000,000000,000000,000000},
  592.   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  593.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  594.           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  595.   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  596.           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  597.           0x03f8,000000,000000,000000,000000,000000,000000},
  598.   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  599.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  600.           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  601.   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  602.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  603.           0x13f8,000000,000000,000000,000000,000000,000000},
  604.   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  605.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  606.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  607.   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  608.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  609.           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  610.   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  611.           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  612.           000000,000000,000000,0x0700,0x0700,0x0700,000000},
  613.   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  614.           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  615.           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  616.   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  617.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  618.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  619.   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  620.           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  621.           0x0209,000000,000000,000000,000000,000000,000000},
  622.   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  623.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  624.           0x03f9,000000,000000,000000,000000,000000,000000},
  625.   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  626.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  627.           0x03f8,000000,000000,000000,000000,000000,000000},
  628.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  629.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  630.           0x03f9,000000,000000,000000,000000,000000,000000},
  631.   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  632.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  633.           0x13f8,000000,000000,000000,000000,000000,000000},
  634.   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  635.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  636.           0x03f9,000000,000000,000000,000000,000000,000000},
  637.   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  638.           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  639.           0x07f8,000000,000000,000000,000000,000000,000000},
  640.   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  641.           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  642.           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  643.   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  644.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  645.           0x1001,000000,000000,000000,000000,000000,000000},
  646.   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  647.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  648.           0x1001,000000,000000,000000,000000,000000,000000},
  649.   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  650.           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  651.           0x1001,000000,000000,000000,000000,000000,000000},
  652.   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  653.           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  654.           0x1001,000000,000000,000000,000000,000000,000000},
  655.   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  656.           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  657.           0x1001,000000,000000,000000,000000,000000,000000},
  658.   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  659.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  660.           0x1fff,000000,000000,000000,000000,000000,000000},
  661.   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  662.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  663.           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  664.   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  665.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  666.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  667.   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  668.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  669.           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  670.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  671.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  672.           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  673.   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  674.           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  675.           0x1249,000000,000000,0x1249,000000,000000,0x1249},
  676. };
  677.  
  678. /*
  679. ** The plotting area is defined as a huge bitmap.
  680. ** The bitmap is stored in a dynamically allocated pixel array b_p
  681. **
  682. ** The bitmap is allocated (and initialized to zero) with
  683. ** b_makebitmap(xsize, ysize, planes)
  684. ** and freed with b_freebitmap()
  685. ** xsize and ysize will be rounded up to a multiple of 8.
  686. **
  687. ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  688. **
  689. ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  690. ** where the point (x,y) is the target to go from the current point
  691. ** To set the color use b_setvalue(value) where value is the value 
  692. ** (0 or 1 or a color number) to be stored in every pixel.
  693. ** To get dotted line styles, use b_setlinetype(linetype).
  694. **
  695. ** Internally all plotting goes through b_setpixel(x, y, value).
  696. */
  697.  
  698.  
  699. /*
  700. ** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  701. */
  702. void
  703. b_setpixel(x, y, value)
  704. unsigned int x, y, value;
  705. {
  706.   register unsigned int row;
  707.   register unsigned char mask;
  708.   int i;
  709.   if (b_rastermode) {
  710.     /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  711.     row = x;  /* temp storage */
  712.     x = y;
  713.     y = b_ysize-1-row;
  714.   }
  715.   if (IN(x, b_xsize) && IN(y, b_ysize))
  716.   {
  717.     row = y/8;
  718.     mask = 1<<(y%8);
  719.  
  720.     for (i=0; i<b_planes; i++) {
  721.         if (value&1)
  722.             *((*b_p)[row]+x) |= mask;
  723.         else
  724.             *((*b_p)[row]+x) &= ~mask;
  725.         row += b_psize;
  726.         value >>= 1;
  727.     }
  728.   }
  729. #ifdef BITMAPDEBUG
  730.   else
  731.   {
  732.     if (b_rastermode)
  733.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", 
  734.         b_ysize-1-y, x, value);
  735.     else
  736.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  737.         x, y, value);
  738.   }
  739. #endif
  740. }
  741.  
  742. /*
  743. ** get pixel (x,y) value----unused
  744. */
  745. /****************************
  746. unsigned int
  747. b_getpixel(x, y)
  748. unsigned int x, y;
  749. {
  750.   register unsigned int row;
  751.   register unsigned char mask;
  752.   register unsigned char value;
  753.   int i;
  754.  
  755.   if (b_rastermode) {
  756.     row = x;
  757.     x = y;
  758.     y = b_ysize-1-row;
  759.   }
  760.   if (IN(x, b_xsize) && IN(y, b_ysize))
  761.   {
  762.     row = y/8 + (b_planes-1)*b_psize;
  763.     mask = 1<<(y%8);
  764.  
  765.     for (i=0; i<b_planes; i++) {
  766.         if ( *((*b_p)[row]+x) & mask )
  767.             value |= 1;
  768.         row -= b_psize;
  769.         value <<= 1;
  770.     }
  771.     return(value);
  772.   }
  773.   else
  774.   {
  775. #ifdef BITMAPDEBUG
  776.     if (b_rastermode)
  777.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  778.         b_ysize-1-y, x);
  779.     else
  780.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  781. #endif
  782.     return(0);
  783.   }
  784. }
  785. ********************************/
  786.  
  787. /*
  788. ** allocate the bitmap
  789. */
  790. void
  791. b_makebitmap(x, y, planes)
  792. unsigned int x, y, planes;
  793. {
  794.   register unsigned j;
  795.   unsigned rows;
  796.  
  797.   x = 8 * (unsigned int)(x/8.0+0.9);    /* round up to multiple of 8 */
  798.   y = 8 * (unsigned int)(y/8.0+0.9);    /* round up to multiple of 8 */
  799.   b_psize = y/8;                    /* size of each plane */
  800.   rows = b_psize * planes;            /* total number of rows of 8 pixels high */
  801.   b_xsize = x; b_ysize = y;
  802.   b_currx = b_curry = 0;
  803.   b_planes = planes;
  804.   b_value = 1;
  805.   b_angle = 0;
  806.   b_rastermode = 0;
  807.   /* allocate row pointers */
  808.   b_p = (bitmap *)alloc( (unsigned long)rows * sizeof(pixels *), "bitmap row buffer");
  809.   memset(b_p, 0, rows * sizeof(pixels *));
  810.   for (j = 0; j < rows; j++) {
  811.     /* allocate bitmap buffers */
  812.     (*b_p)[j] = (pixels *)alloc((unsigned long)x * sizeof(pixels),(char *)NULL);
  813.     if ((*b_p)[j] == (pixels *)NULL) {
  814.         b_freebitmap();  /* free what we have already allocated */
  815.         int_error("out of memory for bitmap buffer", NO_CARET);
  816.     }
  817.     memset((*b_p)[j], 0, x * sizeof(pixels));
  818.   }
  819. }
  820.   
  821. /*
  822. ** free the allocated bitmap
  823. */
  824. void
  825. b_freebitmap()
  826. {
  827.   int j;
  828.   unsigned rows;
  829.  
  830.   rows = b_psize * b_planes;   /* total number of rows of 8 pixels high */
  831.   for (j = 0; j < rows; j++)
  832.   {
  833.     (void) free((char *)(*b_p)[j]);
  834.   }
  835.   (void) free((char *)b_p);
  836.   b_p = (bitmap *)(NULL);
  837. }
  838.  
  839. /*
  840. ** set pixel at (x,y) with color b_value and dotted mask b_linemask.
  841. */
  842. void
  843. b_setmaskpixel(x,y,value)
  844. unsigned int x,y,value;
  845. {
  846.     /* dotted line generator */
  847.     if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
  848.         b_setpixel(x,y,value);
  849.     }
  850.     b_maskcount= (b_maskcount+1) % 16;
  851.     b_lastx= x;  /* last pixel set with mask */
  852.     b_lasty= y;
  853. }
  854.  
  855. /*
  856. ** draw a line from (x1,y1) to (x2,y2)
  857. ** with color b_value and dotted mask b_linemask.
  858. */
  859. void
  860. b_line(x1,y1,x2,y2)
  861. unsigned int x1,y1,x2,y2;
  862. {
  863. int runcount;
  864. int dx,dy;
  865. int xinc,yinc;
  866. unsigned int xplot,yplot;
  867.  
  868.     runcount=0;
  869.     dx = abs((int)(x1)-(int)(x2));
  870.     if (x2>x1)  xinc=  1;
  871.     else if (x2==x1) xinc=  0;
  872.     else  xinc= -1;
  873.     dy = abs((int)(y1)-(int)(y2));
  874.     if (y2>y1)  yinc=  1;
  875.     else if (y2==y1) yinc=  0;
  876.     else  yinc= -1;
  877.     xplot=x1;
  878.     yplot=y1;
  879.     if (dx>dy) {
  880.         /* iterate x */
  881.         if ( (b_linemask==0xffff) ||
  882.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  883.             b_setmaskpixel(xplot,yplot,b_value);
  884.         while (xplot!=x2) {
  885.             xplot+=xinc;
  886.             runcount+=dy;
  887.             if (runcount>=(dx-runcount)) {
  888.                 yplot+=yinc;
  889.                 runcount-=dx;
  890.             }
  891.             b_setmaskpixel(xplot,yplot,b_value);
  892.         }
  893.     } else {
  894.         /* iterate y */
  895.         if ( (b_linemask==0xffff) ||
  896.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  897.             b_setmaskpixel(xplot,yplot,b_value);
  898.         while (yplot!=y2) {
  899.             yplot+=yinc;
  900.             runcount+=dx;
  901.             if (runcount>=(dy-runcount)) {
  902.                 xplot+=xinc;
  903.                 runcount-=dy;
  904.             }
  905.             b_setmaskpixel(xplot,yplot,b_value);
  906.         }
  907.     }
  908. }
  909.  
  910. /*
  911. ** set character size
  912. */
  913. void
  914. b_charsize(size)
  915. unsigned int size;
  916. {
  917.     int j;
  918.     switch(size) {
  919.         case FNT5X9:
  920.             b_hchar = FNT5X9_HCHAR;
  921.             b_hbits = FNT5X9_HBITS;
  922.             b_vchar = FNT5X9_VCHAR;
  923.             b_vbits = FNT5X9_VBITS;
  924.             for (j = 0; j < FNT_CHARS; j++ )
  925.                 b_font[j] = &fnt5x9[j][0];
  926.             break;
  927.         case FNT9X17:
  928.             b_hchar = FNT9X17_HCHAR;
  929.             b_hbits = FNT9X17_HBITS;
  930.             b_vchar = FNT9X17_VCHAR;
  931.             b_vbits = FNT9X17_VBITS;
  932.             for (j = 0; j < FNT_CHARS; j++ )
  933.                 b_font[j] = &fnt9x17[j][0];
  934.             break;
  935.         case FNT13X25:
  936.             b_hchar = FNT13X25_HCHAR;
  937.             b_hbits = FNT13X25_HBITS;
  938.             b_vchar = FNT13X25_VCHAR;
  939.             b_vbits = FNT13X25_VBITS;
  940.             for (j = 0; j < FNT_CHARS; j++ )
  941.                 b_font[j] = &fnt13x25[j][0];
  942.             break;
  943.         default:
  944.             int_error("Unknown character size",NO_CARET);
  945.     }
  946. }
  947.  
  948.  
  949. /*
  950. ** put characater c at (x,y) rotated by angle with color b_value.
  951. */
  952. #ifdef ANSI_C
  953. void b_putc(unsigned int x, unsigned int y,char c, unsigned int angle)
  954. #else
  955. void
  956. b_putc(x,y,c,angle)
  957. unsigned int x,y;
  958. char c;
  959. unsigned int angle;
  960. #endif
  961. {
  962.     unsigned int i, j, k;
  963.     char_row fc;
  964.  
  965.     j = c - ' ';
  966.     for ( i = 0; i < b_vbits; i++ ) {
  967.         fc = *( b_font[j] + i );
  968.         if ( c == '_' ) {    /* treat underline specially */
  969.             if ( fc  ) {    /* this this the underline row ? */
  970.                 /* draw the under line for the full h_char width */
  971.                 for ( k = ( b_hbits - b_hchar )/2;
  972.                     k < ( b_hbits + b_hchar )/2; k++ ) {
  973.                     switch(angle) {
  974.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  975.                             break;
  976.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  977.                             break;
  978.                     }
  979.                 }
  980.             }
  981.         }
  982.         else {
  983.             /* draw character */
  984.             for ( k = 0; k < b_hbits; k++ ) {
  985.                 if ( ( fc >> k ) & 1 ) {
  986.                     switch(angle) {
  987.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  988.                             break;
  989.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  990.                             break;
  991.                     }
  992.                 }
  993.             }
  994.         }
  995.     }
  996. }
  997.  
  998.  
  999. /*
  1000. ** set b_linemask to b_pattern[linetype]
  1001. */
  1002. void
  1003. b_setlinetype(linetype)
  1004. int linetype;
  1005. {
  1006.     if (linetype>=7)
  1007.         linetype %= 7;
  1008.     b_linemask = b_pattern[linetype+2];
  1009.     b_maskcount=0;
  1010. }
  1011.  
  1012. /*
  1013. ** set b_value to value
  1014. */
  1015. void
  1016. b_setvalue(value)
  1017. unsigned int value;
  1018. {
  1019.     b_value = value;
  1020. }
  1021.  
  1022. /*
  1023. ** move to (x,y)
  1024. */
  1025. void
  1026. b_move(x, y)
  1027. unsigned int x, y;
  1028. {
  1029.   b_currx = x;
  1030.   b_curry = y;
  1031. }
  1032.  
  1033. /*
  1034. ** draw to (x,y) with color b_value
  1035. */
  1036. void
  1037. b_vector(x, y)
  1038. unsigned int x, y;
  1039. {
  1040.   b_line(b_currx, b_curry, x, y);
  1041.   b_currx = x;
  1042.   b_curry = y;
  1043. }
  1044.  
  1045.  
  1046. /*
  1047. ** put text str at (x,y) with color b_value and rotation b_angle
  1048. */
  1049. void
  1050. b_put_text(x,y,str)
  1051. unsigned int x, y;
  1052. char *str;
  1053. {
  1054.     if (b_angle == 1)
  1055.         x += b_vchar/2;
  1056.     else
  1057.         y -= b_vchar/2;
  1058.    switch (b_angle) {
  1059.       case 0:
  1060.      for (; *str; ++str, x += b_hchar)
  1061.         b_putc (x, y, *str, b_angle);
  1062.                     break;
  1063.       case 1:
  1064.      for (; *str; ++str, y += b_hchar)
  1065.         b_putc (x, y, *str, b_angle);
  1066.                     break;
  1067.     }
  1068. }
  1069.  
  1070.  
  1071. int
  1072. b_text_angle(ang)
  1073. int ang;
  1074. {
  1075.     b_angle=(unsigned int)ang;
  1076.     return TRUE;
  1077. }
  1078.